package org.polyforms.repository;

import java.util.List;

/**
 * A updatable {@link Repository} which has some convenient methods to update entity instance of entity class specified
 * in generic type parameter.
 * 
 * @param <T> type of entity
 * 
 * @author Kuisong Tong
 * @since 1.0
 */
public interface UpdatableRepository<T> extends Repository<T> {
    /**
     * Add an entity instance into repository.
     * 
     * @param entity which is to be added into repository
     * 
     * @throws IllegalArgumentException if the entity instance is null
     */
    void add(T entity);

    /**
     * Remove an entity instance from repository.
     * 
     * @param entity which is to be removed from repository
     * 
     * @throws IllegalArgumentException if the entity instance is null
     */
    void remove(T entity);

    /**
     * Remove specified entity instances from repository.
     * 
     * @param entities which are to be removed from repository
     * 
     * @throws IllegalArgumentException if the entities is null or entities has null value
     */
    void remove(List<T> entities);
}
